﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL;
using Module;

namespace BLL
{
    public class BStateComment
    {

        #region 字段

        private DStateComment APP = new DStateComment();//数据操作对象
        private static BStateComment instance;

        #endregion

        #region 公共接口
        /// <summary>
        /// 取得
        /// </summary>
        /// <returns>BStateComment对象</returns>
        public static BStateComment getInstance()
        {
            if (instance == null)
            {
                instance = new BStateComment();
            }
            return instance;
        }
        /// <summary>
        /// 发表状态回复
        /// </summary>
        /// <param name="stateCommentInfo"></param>
        /// <returns></returns>
        public bool Insert(StateCommentInfo stateCommentInfo)
        {
            if (stateCommentInfo == null || stateCommentInfo.StateCommentId == 0)
                return false;
            return APP.Insert(stateCommentInfo);
                
        }

         /// <summary>
        /// 更新状态回复
        /// </summary>
        /// <param name="stateCommentInfo"></param>
        /// <returns></returns>
        public bool Update(StateCommentInfo stateCommentInfo)
        {
             if (stateCommentInfo == null || stateCommentInfo.StateCommentId == 0)
                return false;
             return APP.Update(stateCommentInfo);

        }

        /// <summary>
        /// 根据Id删除
        /// </summary>
        /// <param name="stateCommentId"></param>
        /// <returns></returns>
        public int Delete(long stateCommentId)
        {
            if (stateCommentId == 0)
                return 0;
            return APP.Delete(stateCommentId);

        }
        /// <summary>
        /// 根据用户发表的状态ID获取回复
        /// </summary>
        /// <param name="userStateId"></param>
        /// <returns></returns>
        public List<StateCommentInfo> GetAllCommentByStatId(long userStateId)
        {
            if (userStateId == 0)
                return null;
            return APP.GetAllCommentByStatId(userStateId);
        }
        #endregion
    }
}
